package com.whfc.openapi.api.fim.controller;

import com.whfc.common.result.Result;
import com.whfc.common.result.ResultUtil;
import com.whfc.fim.dto.FimAlgTypeDTO;
import com.whfc.fim.service.FimWarnRuleService;
import com.whfc.fuum.dto.open.OpenApiClientDTO;
import com.whfc.openapi.constant.OpenApiConst;
import org.apache.dubbo.config.annotation.DubboReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description:
 * @Author: qzexing
 * @Version: 1.0
 * @Date: 2020/1/9 16:06
 */
@RestController
@RequestMapping("/open/api/v1/fim")
public class FimAlgDataSyncController {

    Logger logger = LoggerFactory.getLogger(this.getClass());

    @DubboReference(interfaceClass = FimWarnRuleService.class, version = "1.0.0")
    private FimWarnRuleService fimWarnRuleService;

    /**
     * 获取项目配置的算法类型库信息
     */
    @RequestMapping("alg/type")
    public Result algTypeList(@RequestAttribute(OpenApiConst.OPENAPI_CLIENT) OpenApiClientDTO clientDTO) {
        logger.info("获取法类型库信息,client:[{}]", clientDTO);
        List<FimAlgTypeDTO> fimAlgTypeSyncDTOS = fimWarnRuleService.algTypeList(2);
        Map<String, List<FimAlgTypeDTO>> map = new HashMap<>();
        map.put("data", fimAlgTypeSyncDTOS);
        return ResultUtil.success(fimAlgTypeSyncDTOS);
    }


}
